package com.ymatou.shoppingcart.api.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 购物车中当前总金额和运费Call FreeMaker Template自动生成代码
 */
public class GetShoppingCartPriceCall extends YmatouBaseCall {
	private static String opurl = "api/query/GetShoppingCartPrice";

	public GetShoppingCartPriceCall() {
		super(EnvSetup.getSystemUrl("api_shoppingcart"), opurl, "GET", "PARAM");
	}

	/**
	 * 获取金额
	 * 
	 * @return 金额
	 */
	public String getPrice() {
		String Price = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			JSONObject data = jo.getJSONObject("Data");
			Price = data.get("Price").toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Price;
	}

	/**
	 * 获取运费
	 * 
	 * @return 运费
	 */
	public String getFreight() {
		String Freight = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			JSONObject data = jo.getJSONObject("Data");
			Freight = data.get("Freight").toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Freight;
	}

	/**
	 * 获取Code
	 * 
	 * @return Code
	 */
	public String getCode() {
		String Code = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Code = String.valueOf(jo.get("Code"));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取BCode
	 * 
	 * @return BCode
	 */
	public String getBCode() {
		String BCode = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			BCode = String.valueOf(jo.get("BCode"));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}

	/**
	 * 获取Msg
	 * 
	 * @return Msg
	 */
	public String getMsg() {
		String Msg = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Msg = (String) jo.get("Msg");

		} catch (Exception e) {
			e.printStackTrace();
		}
		return Msg;
	}
}